public class L509 {

    public static void main(String[] args) {
        int fib = new Solution().fib(4);
        System.out.println(fib);

    }

    static class Solution {
        public int fib(int n) {
            if (n == 0) {
                return 0;
            }
            if (n == 1) {
                return 1;
            }

            int res = 0;
            int tmp = 0;
            int tmp2 = 1;
            for (int i = 2; i <= n; i++) {
                res = tmp + tmp2;
                tmp = tmp2;
                tmp2 = res;
            }
            return res;

        }
    }
}
